<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-for循环</title>
    <script src="js/vuejs-2.5.16.js"></script>
</head>
<body>
<div id="app">
    <table border="1">
        <tr>
            <th>序号</th>
            <th>编号</th>
            <th>名称</th>
            <th>价格</th>
        </tr>

        <tr v-for="(product,index) in products">
            <td>{{index}}</td>
            <td>{{product.id}}</td>
            <td>{{product.name}}</td>
            <td>{{product.price}}</td>
        </tr>
    </table>
</div>

</body>
<script>
    new Vue({
        el:"#app",
        data:{
            products:[
                {id:1,name:"笔记本电脑",price:5000},
                {id:2,name:"手机",price:3000},
                {id:3,name:"电视机",price:4000}
            ]
        }
    });
</script>
</html>